home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
batch
/
tsbat30
/
delpath.bat
< prev
next >
Wrap
DOS Batch File
|
1990-10-21
|
2KB
|
64 lines
echo off
echo.
echo ┌───────────────────────────────────────────────────┐
echo │ Delete a directory from the path variable │
echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, 21-Oct-90 │
echo └───────────────────────────────────────────────────┘
echo.
if "%1"=="" goto _help
if "%2"=="" goto _label_1
echo The extra parameters are ignored
rem Change the directory-name parameter to upper case
:_label_1
set _stash=%path%
path %1
set _dir=%path%
path %_stash%
set _stash=
rem Check that the auxiliary file setvar.bat is available
set _found=
if exist setvar.bat set _found=yes
for %%d in (%path%) do if exist %%d\setvar.bat set _found=yes
if "%_found%"=="yes" goto _label_2
echo Auxiliary file setvar.bat must be at path or in the current directory
goto _out
rem Check if there is such a directory (not really necessary)
:_label_2
set _found=
for %%d in (%path%) do if "%%d"=="%_dir%" set _found=yes
if "%_found%"=="yes" goto _label_3
echo Directory %_dir% not at path
goto _out
rem Build the path anew
:_label_3
set _newpath=
for %%d in (%path%) do if not "%%d"=="%_dir%" call setvar %%d
path %_newpath%
goto _out
:_help
echo Usage: DELPATH [Directory]
echo.
echo MsDos version 3.30 required.
echo SETVAR.BAT mush be at path.
echo.
echo If you get an "Out of environment space" message, increase your
echo environment space by using shell configuration in config.sys:
echo Example: shell=c:\bin\command.com /e:1024 /p
echo.
echo Current path %path%
goto _out2
:_out
set _newpath=
set _dir=
set _found=
path
:_out2
echo on